﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Invoice.aspx.cs" Inherits="AlbonWeb.Manager.OrderManager.Invoice"
    ValidateRequest="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Invoice</title>
    <link href="/css/dialog.css" rel="stylesheet" type="text/css" />
    <script src="/js/ADS.js" type="text/javascript"></script>
    <style type="text/css" media="print">
        .NoPrint
        {
            display: none;
        }
    </style>
</head>
<body style="font-size: 12px">
    <form id="theForm" runat="server">
    <table border="1" cellpadding="1" cellspacing="1" class="inputTable" style="width: 100%">
        <tr>
            <td align="center" colspan="4">
                <strong><span style="font-size: 25pt">INVOICE</span></strong>
            </td>
        </tr>
        <tr>
            <td style="width: 20%">
                <strong>Invoice#:</strong>
            </td>
            <td style="width: 30%">
                <asp:Label ID="invoiceNo" runat="server" Text=""></asp:Label>
            </td>
            <td style="width: 20%">
                <strong>Dealer:</strong>
            </td>
            <td>
                <asp:Label ID="userName" runat="server" Text=""></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <strong>RefNo:</strong>
            </td>
            <td>
                <asp:Label ID="refNo" runat="server" Text="New Order"></asp:Label>
            </td>
            <td>
                <strong>Pay Method:</strong>
            </td>
            <td>
                <asp:Label ID="payMethod" runat="server" Text=""></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <strong>Ship Method</strong>
            </td>
            <td>
                <asp:Label ID="shipMethod" Text="" runat="server" />
            </td>
            <td>
                <strong>Total Date</strong>
            </td>
            <td>
                <strong>
                    <asp:Label ID="totalDate" runat="server">Not Totaled</asp:Label></strong>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="4">
            </td>
        </tr>
    </table>
    <div class="panel">
        <div id="clothCharge" class="blockName">
            <div class="left">
                <strong>Cloth Charges:</strong></div>
            <div class="right">
                <strong>Total Cloth(US$):<asp:Label class="charge" ID="clothMoney" runat="server">0.00</asp:Label></strong></div>
            <div class="data">
                <table width="100%" class="detail_table">
                    <asp:Repeater ID="repCloth" runat="server">
                        <HeaderTemplate>
                            <tr class="detail_head">
                                <td>
                                    No
                                </td>
                                <td style="width: 25%">
                                    Item
                                </td>
                                <td>
                                    Company
                                </td>
                                <td>
                                    Cloth #
                                </td>
                                <td>
                                    Width
                                </td>
                                <td>
                                    Size
                                </td>
                                <td>
                                    QTY
                                </td>
                                <td>
                                    Price
                                </td>
                                <td>
                                    Total US$
                                </td>
                            </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <%#Container.ItemIndex+1 %>
                                </td>
                                <td>
                                    <%#Eval("styleName") %>
                                </td>
                                <td>
                                    <%#Eval("companyName")%>
                                </td>
                                <td>
                                    <%#Eval("clothNo") %>
                                </td>
                                <td>
                                    <%#Eval("widthKind") %>
                                </td>
                                <td>
                                    <%#Eval("clothSize") %>
                                </td>
                                <td>
                                    <%#Eval("quantity") %>
                                </td>
                                <td>
                                    <%#Eval("price") %>
                                </td>
                                <td>
                                    <%#string.Format("{0:0.00}",decimal.Parse(Eval("total").ToString())) %>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </div>
        </div>
        <div id="itemCharge" class="blockName">
            <div class="left">
                <strong>Item Charges:</strong>
            </div>
            <div class="right">
                <strong>Total Item(US$):<asp:Label class="charge" ID="itemMoney" runat="server">0.00</asp:Label></strong>
            </div>
            <div class="data">
                <table width="100%" class="detail_table">
                    <asp:Repeater ID="repItem" runat="server">
                        <HeaderTemplate>
                            <tr class="detail_head">
                                <td>
                                    No
                                </td>
                                <td style="width: 25%">
                                    Item
                                </td>
                                <td>
                                    QTY
                                </td>
                                <td>
                                    FT
                                </td>
                                <td>
                                    FSPrice
                                </td>
                                <td>
                                    AFPrice
                                </td>
                                <td>
                                    Total
                                </td>
                            </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <%#Container.ItemIndex+1 %>
                                </td>
                                <td style="width: 25%">
                                    <%#Eval("itemName") %>
                                </td>
                                <td>
                                    <%#Eval("quantity") %>
                                </td>
                                <td>
                                    <%#Eval("FT") %>
                                </td>
                                <td>
                                    <%#string.Format("{0:0.00}",decimal.Parse(Eval("FSPrice").ToString())) %>
                                </td>
                                <td>
                                    <%#string.Format("{0:0.00}",decimal.Parse(Eval("AFPrice").ToString())) %>
                                </td>
                                <td>
                                    <%#Eval("total") %>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </div>
        </div>
        <div id="styleCharge" class="blockName">
            <div class="left">
                <strong>Style Charges:</strong>
            </div>
            <div class="right">
                <strong>Total Style(US$):<asp:Label class="charge" ID="styleMoney" runat="server">0.00</asp:Label></strong>
            </div>
            <div class="data">
                <asp:DataList ID="dlItem" runat="server" Width="99%">
                    <ItemTemplate>
                        <table style="width: 60%">
                            <tr>
                                <td colspan="2">
                                    <strong>
                                        <%# Eval("itemName")%>
                                        [<strong>Qty:
                                            <asp:Label ID="Qty" Text='<%#Eval("quantity") %>' runat="server" /></strong>]
                                    </strong>
                                    <asp:HiddenField ID="hforderitemid" runat="server" Value='<%#Eval("ID") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td width="3%">
                                </td>
                                <td>
                                    <table width="100%">
                                        <asp:Repeater ID="repStyle" runat="server">
                                            <HeaderTemplate>
                                                <tr class="detail_head">
                                                    <td>
                                                        <strong>Style Name</strong>
                                                    </td>
                                                    <td>
                                                        <strong>Price</strong>
                                                    </td>
                                                </tr>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <tr>
                                                    <td>
                                                        <%#Eval("topName") %>_<%#Eval("styleName")%>
                                                    </td>
                                                    <td>
                                                        <%#string.Format("{0:0.00}",decimal.Parse(Eval("stylePrice").ToString()))%>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:DataList>
            </div>
        </div>
        <div id="RushCharge" style="display: none" class="blockName">
            <div class="left">
                <strong>Rush Charge</strong>
            </div>
            <div class="right">
                <strong>Total Rush(US$):
                    <asp:Label class="charge" ID="rushMoney" runat="server">0.00</asp:Label></strong>
            </div>
            <div class="data">
                <asp:GridView ID="GVOrderDatetime" runat="server" AutoGenerateColumns="False" Width="100%">
                    <Columns>
                        <asp:TemplateField HeaderText="NO">
                            <ItemTemplate>
                                <%#(int)DataBinder.Eval(Container,"DataItemIndex") + 1 %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Item_Name" HeaderText="Item" />
                        <asp:BoundField DataField="Qty" HeaderText="QTY" />
                        <asp:TemplateField HeaderText="FT">
                            <ItemTemplate>
                                <asp:Label ID="lblFT" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Cost_FSPrice" HeaderText="Unit Price" DataFormatString="{0:N2}"
                            HtmlEncode="False" />
                        <asp:TemplateField HeaderText="Days">
                            <ItemTemplate>
                                <asp:HiddenField ID="HFcreateDate" Value='<%#Eval("createDate") %>' runat="server" />
                                <asp:HiddenField ID="HFOrderDate" runat="server" Value='<%#Eval("Order_RushFSTime") %>' />
                                <asp:Label ID="lbldays" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Cost">
                            <ItemTemplate>
                                <asp:Label ID="lblCMTCost" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
        <div id="OverSizeCharges" class="blockName">
            <div class="left">
                <strong>OverSize Charges:</strong>
            </div>
            <div class="right">
                <strong>Total OverSize(US$):<asp:Label class="charge" ID="overSizeMoney" runat="server">0.00</asp:Label></strong>
            </div>
            <div class="data">
                <table width="100%" class="detail_table">
                    <asp:Repeater ID="repOverSize" runat="server">
                        <HeaderTemplate>
                            <tr class="detail_head">
                                <td style="width: 25%">
                                    Item
                                </td>
                                <td>
                                    Size Item
                                </td>
                                <td>
                                    Size
                                </td>
                                <td>
                                    QTY
                                </td>
                                <td>
                                    Item Price
                                </td>
                                <td>
                                    Percentage
                                </td>
                                <td>
                                    Total
                                </td>
                            </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <%#Eval("styleName") %>
                                </td>
                                <td style="width: 25%">
                                    <%#Eval("itemName") %>
                                </td>
                                <td>
                                    <%#Eval("bodySize") %>
                                </td>
                                <td>
                                    <%#Eval("qty") %>
                                </td>
                                <td>
                                    <%#Eval("itemPrice") %>
                                </td>
                                <td>
                                    <%#Eval("percentage") %>
                                </td>
                                <td>
                                    <%#string.Format("{0:0.00}",Eval("total").ToString()) %>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </div>
        </div>
        <div id="ShippingCharges" class="blockName" runat="server">
            <div class="left">
                <strong>Shipping Charges:</strong>
            </div>
            <div class="right">
                <strong>Total Shipping(US$):<asp:Label class="charge" ID="shipMoney" runat="server">0.00</asp:Label></strong>
            </div>
            <div class="data">
                <table>
                    <tr>
                        <td style="width: 50%; vertical-align: top">
                            <table width="100%" class="detail_table">
                                <asp:Repeater ID="repShip" runat="server">
                                    <HeaderTemplate>
                                        <tr class="detail_head">
                                            <td>
                                                Item
                                            </td>
                                            <td>
                                                QTY
                                            </td>
                                            <td>
                                                FT
                                            </td>
                                            <td>
                                                Weight
                                            </td>
                                            <td>
                                                Total(kg)
                                            </td>
                                        </tr>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <tr>
                                            <td>
                                                <%#Eval("itemName") %>
                                            </td>
                                            <td>
                                                <%#Eval("quantity") %>
                                            </td>
                                            <td>
                                                <%#Eval("FT")%>
                                            </td>
                                            <td>
                                                <%#Eval("weight")%>
                                            </td>
                                            <td>
                                                <%#Eval("total") %>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </table>
                        </td>
                        <td>
                            <span lang="EN-US" style="font-size: 8pt; font-family: Georgia;">
                                <%--This is an Estimated
                                Shipping Charge only and does not reflect the actual charge(s) incurred, &nbsp;--%>Dealer
                                is responsible for additional shipping charge if actual costs are greater than Estimated
                                Shipping Charge. If Shipping Costs are lower than Estimated Shipping Charge, a credit
                                for the difference will be provided.&nbsp;<%--Credit will be listed every 30 days in
                                your “My Account”.&nbsp;As part of our dedication is to ensure the lowest shipping
                                cost, we will continue to bundle orders to further reduce your costs.--%>
                            </span>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div id="extraCharge" class="blockName">
            <div class="left">
                <b>Extra Charge:</b>
            </div>
            <div class="right">
                <strong>Total Extras(US$):<asp:Label class="charge" ID="extraMoney" runat="server">0.00</asp:Label></strong>
            </div>
            <div class="data">
                <table width="80%">
                    <asp:Repeater ID="repExtra" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <%#Eval("remark") %>
                                </td>
                                <td>
                                    <%#string.Format("{0:0.00}",decimal.Parse(Eval("extraCharge").ToString()))%>
                                </td>
                                <td>
                                    <asp:ImageButton ID="imgDelete" class="NoPrint" title="disable" ImageUrl="/images/grv_delete.gif"
                                        CommandName='<%#Eval("ID")%>' OnClientClick="return confirm('Are You Sure to Delete?')"
                                        runat="server" OnClick="imgDelete_Click" />
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
                <div class="NoPrint" title="disable" style="margin-left: 10px">
                    <b>Extra Charge:</b>
                    <asp:TextBox title="disable" class="number" Width="50px" runat="server" ID="Extra" />
                    <b>Remark:</b>
                    <asp:TextBox title="disable" Width="300px" runat="server" ID="Remark" />
                    <asp:Button title="disable" Text="Add" ID="addExtras" runat="server" OnClick="addExtras_Click" />
                </div>
            </div>
        </div>
        <div class="data">
            <table border="1" cellpadding="0" cellspacing="0" class="inputTable" style="width: 100%">
                <tr>
                    <td>
                        <strong>Payment Method:</strong>
                        <asp:DropDownList ID="ddlpayMethod" title="disable" runat="server" onChange="totalCharge()">
                        </asp:DropDownList>
                    </td>
                    <td align="right">
                        <strong>Preliminary Total(US$):</strong>
                        <asp:Label ID="finalTotal" Text="0.00" runat="server" />
                        <asp:HiddenField ID="hftotal" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="left" width="68%" style="font-size: 8pt">
                        <p class="default" style="margin: 0cm 0cm 0pt">
                            <span lang="EN-US" style="font-size: 8pt; font-family: Georgia;">Preliminary Total.
                                Adjustments may be made to this total depending details of the order. Please check
                                back periodically to see if there are any revisions. Total will be finalized prior
                                to shipment and will also be listed in your "My Account". </span>
                        </p>
                    </td>
                </tr>
            </table>
        </div>
        <div style="text-align: center; width: 70%; float: left">
            <asp:Button ID="Total" Text="Total" title="disable" runat="server" class="NoPrint"
                OnClick="Total_Click" />
            <input type="button" class="NoPrint" value="Print" onclick='window.print()' />
        </div>
        <div style="text-align: left; width: 28%; float: left">
        </div>
        <div style="clear: both">
        </div>
    </div>
    </form>
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
    <input type="hidden" name="cmd" value="_s-xclick" />
    <input type="hidden" name="hosted_button_id" value="1969342" />
    <table class="NoPrint">
        <tr>
            <td>
                <input type="hidden" name="on0" value="Enter Invoice / Grand Total as QUANTITY in PAYMENT PAGE" />
                Enter Invoice / Grand Total as QUANTITY in PAYMENT PAGE Grand Total as QUANTITY
                in PAYMENT PAGE UANTITY in PAYMENT PAGE
            </td>
        </tr>
        <tr>
            <td>
                <input type="text" name="os0" maxlength="60" />
            </td>
        </tr>
    </table>
    </form>
    <script type="text/javascript" language="javascript">
        ADS.addEvent(window, 'load', totalCharge);
        var extras = ADS.getElementByClassName("extra", "input");
        for (var i = 0; i < extras.length; i++) {
            ADS.addEvent(extras[i], 'change', function () {
                if (parseInt(this.value) > 0) {
                    ADS.$('extraCharge').className = 'blockName';
                }
                totalCharge();
            });
        }
        ADS.addEvent(ADS.$('Total'), 'click', totalCharge);
        function totalCharge() {
            var total = 0;
            var charges = ADS.getElementByClassName('charge');
            for (var i = 0; i < charges.length; i++) {
                if (charges[i].value) {
                    total += parseFloat(charges[i].value);
                }
                else {
                    total += parseFloat(charges[i].innerHTML);
                }

            }
            ADS.$('hftotal').value = total.toFixed(2);
            var percentage = parseFloat(ADS.$('ddlpayMethod').value);
            total = total * (1 + percentage);
            ADS.$('finalTotal').innerHTML = total.toFixed(2);
        }
    </script>
</body>
</html>
